;Tektronix MDO3000, MDO4000, MSO4000, DPO400 Oscilloscopes
;10/31/2020 REV D   Added horizontal Setup tab.
;                   Fixed a buch of interface commands to strip echoed command text on get.
;                   Switched the channel interface to virtual instead of CH # in command name.
;10/17/2020 Rev C   Added metaSections to properly handle dual versus quad channels.
;9/6/2020   Rev B   Add interface, add a bunch more scope models
;8/1/2020   Rev A   Originate

; Tested with Tektronix TDS3000C, DPO3000, MSO3000, MDO3000 over Ethernet.
; By adding metadef entries probably would work with:
; DPO/MSO4000, MSO5000, Sereis 4, Series 5, Series 6, and possibly others.
; This file does not change inteface for 2 versus 4 channels.
; To make usage simple, all supported devices have the same handle name.

;Socket interface and LXI are possible.  This uses LXI interface by default.
;MDO3000 socket interface with protocol = None works with default port of 4000.  Approx 10x faster.
;DPO/MSO socket interface with protocol = None does not work.  With protocol = Terminal very slow. 

;*IDN? returns: TEKTRONIX,<Model>,<Serial Num>:<Configured Num> FV:<FW version num>

;Log values are alphabetized by handle name.  To help get log data order the same below
;uses "hack" of starting each handle name with letter "M" even if actual name does not.

;#idstring TEKTRONIX,MSO56 
;#name Tektronix MSO056 TekScope 
;#replaceText MaxCH 6 
;#replaceText MaxBW 1000M 
;#sections QuadMode QuadSetup QuadInterface ReadStandard

#metadef 
#idstring TEKTRONIX,MDO3012 
#name Tektronix MDO3012 TekScope 
#replaceText MaxCH 2 
#replaceText MaxBW 100M 
#replaceText MaxSample 2.5G 
#sections DualMode ReadSkip

#metadef 
#idstring TEKTRONIX,MDO3014 
#name Tektronix MDO3014 TekScope 
#replaceText MaxCH 4 
#replaceText MaxBW 100M 
#replaceText MaxSample 2.5G 
#sections QuadMode QuadSetup QuadInterface ReadSkip

#metadef 
#idstring TEKTRONIX,MDO3022 
#name Tektronix MDO3022 TekScope 
#replaceText MaxCH 2 
#replaceText MaxBW 200M 
#replaceText MaxSample 2.5G 
#sections DualMode ReadSkip

#metadef 
#idstring TEKTRONIX,MDO3024 
#name Tektronix MDO3024 TekScope 
#replaceText MaxCH 4 
#replaceText MaxBW 200M 
#replaceText MaxSample 2.5G 
#sections QuadMode QuadSetup QuadInterface ReadSkip

#metadef 
#idstring TEKTRONIX,MDO3032 
#name Tektronix MDO3032 TekScope 
#replaceText MaxCH 2 
#replaceText MaxBW 350M 
#replaceText MaxSample 2.5G 
#sections DualMode ReadSkip

#metadef 
#idstring TEKTRONIX,MDO3034 
#name Tektronix MDO3034 TekScope 
#replaceText MaxCH 4 
#replaceText MaxBW 350M 
#replaceText MaxSample 2.5G 
#sections QuadMode QuadSetup QuadInterface ReadSkip

#metadef 
#idstring TEKTRONIX,MDO3052 
#name Tektronix MDO3052 TekScope 
#replaceText MaxCH 2 
#replaceText MaxBW 500M 
#replaceText MaxSample 2.5G 
#sections DualMode ReadSkip

#metadef 
#idstring TEKTRONIX,MDO3054 
#name Tektronix MDO3054 TekScope 
#replaceText MaxCH 4 
#replaceText MaxBW 500M 
#replaceText MaxSample 2.5G 
#sections QuadMode QuadSetup QuadInterface ReadSkip

#metadef 
#idstring TEKTRONIX,MDO3102 
#name Tektronix MDO3102 TekScope 
#replaceText MaxCH 2 
#replaceText MaxBW 1G 
#replaceText MaxSample 5G 
#sections DualMode ReadSkip

#metadef 
#idstring TEKTRONIX,MDO3104 
#name Tektronix MDO3104 TekScope 
#replaceText MaxCH 4 
#replaceText MaxBW 1G 
#replaceText MaxSample 5G 
#sections QuadMode QuadSetup QuadInterface ReadSkip


#metadef 
#idstring TEKTRONIX,MDO4024 
#name Tektronix MDO4024 TekScope 
#replaceText MaxCH 4 
#replaceText MaxBW 200G 
#replaceText MaxSample 2.5G 
#sections QuadMode QuadSetup QuadInterface ReadSkip

#metadef 
#idstring TEKTRONIX,MDO4034 
#name Tektronix MDO4034 TekScope 
#replaceText MaxCH 4 
#replaceText MaxBW 350G 
#replaceText MaxSample 2.5G 
#sections QuadMode QuadSetup QuadInterface ReadSkip

#metadef 
#idstring TEKTRONIX,MDO4054 
#name Tektronix MDO4054 TekScope 
#replaceText MaxCH 4 
#replaceText MaxBW 500G 
#replaceText MaxSample 2.5G 
#sections QuadMode QuadSetup QuadInterface ReadSkip

#metadef 
#idstring TEKTRONIX,MDO4104 
#name Tektronix MDO4104 TekScope 
#replaceText MaxCH 4 
#replaceText MaxBW 1G 
#replaceText MaxSample 5G 
#sections QuadMode QuadSetup QuadInterface ReadSkip



#metadef 
#idstring TEKTRONIX,TDS 3012C 
#name Tektronix TDS3012C TekScope 
#replaceText MaxCH 2 
#replaceText MaxBW 100M 
#replaceText MaxSample 1.25G 
#sections DualMode ReadSkip

#metadef 
#idstring TEKTRONIX,TDS 3014C 
#name Tektronix TDS3014C TekScope 
#replaceText MaxCH 4 
#replaceText MaxBW 100M 
#replaceText MaxSample 1.25G 
#sections QuadMode QuadSetup QuadInterface ReadSkip

#metadef 
#idstring TEKTRONIX,TDS 3032C 
#name Tektronix TDS3032C TekScope 
#replaceText MaxCH 2 
#replaceText MaxBW 300M 
#replaceText MaxSample 2.5G 
#sections DualMode ReadSkip

#metadef 
#idstring TEKTRONIX,TDS 3034C 
#name Tektronix TDS3034C TekScope 
#replaceText MaxCH 4 
#replaceText MaxBW 300M 
#replaceText MaxSample 2.5G 
#sections QuadMode QuadSetup QuadInterface ReadSkip

#metadef 
#idstring TEKTRONIX,TDS 3052C 
#name Tektronix TDS3052C TekScope 
#replaceText MaxCH 2 
#replaceText MaxBW 500M 
#replaceText MaxSample 5G 
#sections DualMode ReadSkip

#metadef 
#idstring TEKTRONIX,TDS 3054C 
#name Tektronix TDS3054C TekScope 
#replaceText MaxCH 4 
#replaceText MaxBW 500M 
#replaceText MaxSample 5G 
#sections QuadMode QuadSetup QuadInterface ReadSkip


#metadef 
#idstring TEKTRONIX,DPO3012 
#name Tektronix DPO3012 TekScope 
#replaceText MaxCH 2 
#replaceText MaxBW 100G 
#replaceText MaxSample 2.5G 
#sections DualMode ReadStandard

#metadef 
#idstring TEKTRONIX,DPO3014 
#name Tektronix DPO3014 TekScope 
#replaceText MaxCH 4 
#replaceText MaxBW 100G 
#replaceText MaxSample 2.5G 
#sections QuadMode QuadSetup QuadInterface ReadStandard

#metadef 
#idstring TEKTRONIX,DPO3032 
#name Tektronix DPO3032 TekScope 
#replaceText MaxCH 2 
#replaceText MaxBW 300G 
#replaceText MaxSample 2.5G 
#sections DualMode ReadStandard

#metadef 
#idstring TEKTRONIX,DPO3034 
#name Tektronix DPO3034 TekScope 
#replaceText MaxCH 4 
#replaceText MaxBW 300G 
#replaceText MaxSample 2.5G 
#sections QuadMode QuadSetup QuadInterface ReadStandard

#metadef 
#idstring TEKTRONIX,DPO3052 
#name Tektronix DPO3052 TekScope 
#replaceText MaxCH 2 
#replaceText MaxBW 500G 
#replaceText MaxSample 2.5G 
#sections DualMode ReadStandard

#metadef 
#idstring TEKTRONIX,DPO3054 
#name Tektronix DPO3054 TekScope 
#replaceText MaxCH 4 
#replaceText MaxBW 500G 
#replaceText MaxSample 2.5G 
#sections QuadMode QuadSetup QuadInterface ReadStandard

#metadef 
#idstring TEKTRONIX,MSO3012 
#name Tektronix MSO3012 TekScope 
#replaceText MaxCH 2 
#replaceText MaxBW 100G 
#replaceText MaxSample 2.5G 
#sections DualMode ReadStandard

#metadef 
#idstring TEKTRONIX,MSO3014 
#name Tektronix MSO3014 TekScope 
#replaceText MaxCH 4 
#replaceText MaxBW 100G 
#replaceText MaxSample 2.5G 
#sections QuadMode QuadSetup QuadInterface ReadStandard

#metadef 
#idstring TEKTRONIX,MSO3032 
#name Tektronix MSO3032 TekScope 
#replaceText MaxCH 2 
#replaceText MaxBW 300G 
#replaceText MaxSample 2.5G 
#sections DualMode ReadStandard

#metadef 
#idstring TEKTRONIX,MSO3034 
#name Tektronix MSO3034 TekScope 
#replaceText MaxCH 4 
#replaceText MaxBW 300G 
#replaceText MaxSample 2.5G 
#sections QuadMode QuadSetup QuadInterface ReadStandard

#metadef
#replaceText MaxCH 4
#replaceText MaxBW 500G
#replaceText MaxSample 2.5G
#sections QuadMode QuadSetup QuadInterface ReadStandard

#meta
#idstring TEKTRONIX,MSO3054
#name Tektronix MSO3054 TekScope
#handle OscTek
#port LXI 4000
#author gby
#notes This file supports and has been tested with Tektronix MDO3000, MSO3000, DPO3000, and TDS3000C series oscilloscopes communicating over Ethernet.  It includes MDO4000 series which should work but was not tested.  It probably would support any Tektronix scope family from year 2000 onward just by adding appriopriate #metadef sections.  Logs the 4 full and 1 "immediate" measurements.  All these models support LXI communictions and some (like MDO3000) also support direct on port 4000.

; A list of possible column name with unit and formatter (SI, Time, Int, D0..D6) 
; Format: #value ColumnName Unit Format {Selector}
; Selector is only used when column layout varies with mode, this often require the use of #cmdMode
#Value Meas1 - SI
#Value Meas2 - SI
#Value Meas3 - SI
#Value Meas4 - SI
#Value MeasI - SI

; How to poll for data, this is used for table and #values?
; a #askMode, #cmdMode and #prepareSample is used before this is string is used.--
; Number of returned values must match number of columns defined with #value
; This is a single line command

#askValues MEASUREMENT:MEAS1:VALUE?;MEASUREMENT:MEAS2:VALUE?;MEASUREMENT:MEAS3:VALUE?;MEASUREMENT:MEAS4:VALUE?;MEASURE:IMMED:VALUE?

; Format of answer: f=float, u=remove trailing letters, x=skip, *=Zero upper case values if this value is 0
; MDO3000 and others echo the command with the number and need readformat xf to skip over the command echo.
; DPO/MSO3000 does not echo the command and needs readformat just ffff
#metaSection ReadSkip
#askValuesReadFormat xFxFxFxFxF
#metaSection

#metaSection ReadStandard
#askValuesReadFormat FFFFF
#metaSection

; There must be a line for each of the original device commands that will be used, converting it to a similar SCPI command
;#scpiCmd init tx command to init
;#scpiCmd values? txrx? command to read current value or values. It is possible to define value1?, value2?, etc. and then use them all with a ; between in the #askValues statement.

; Accept this delay when reading values (seconds)
#readingDelay 2

; Mode change have a longer delay on reading values (seconds)
#modeChangeDelay 10


; String to ask about actual meter mode, it is mostly used for DMM's
; This is a single line command
;#askMode 


; When one of these commands are used through the command interface a new configuration will be done before using #askMode
; Only one word for each #mayModifyMode
; Specify command without initial colon and in the shortest possible form
;#mayModifyMode 


; Prepare the meter to response to #askValues
;#prepareSample arm:sour imm;:arm:count 1;:trig:sour imm;:trig:count 1;:trig:samp:count 1;init

; Initial commands to meter when establishing connection, used to disable local control
;#initCmd  

; Final command to meter before breaking connection, used to restore local control
;#finalCmd 

; Used to turn output off for power supplies, generators and electronic loads
;Also AXIS2.DIS?; for dual axis.  Delay at end add ;[xxx] for xxx mSec delay after.
;#outputOff 

#metaSection DualInterface
#interfaceType OSC OSC:2
#metaSection

#metaSection QuadInterface
#interfaceType OSC OSC:2 OSC:3 OSC:4
#metaSection

;********  Scope channel set ups.
; Using multi-channel interface in scripts requires vars set for OSC:2, OSC:3, etc in scripts.
; For example:
;  =var osc1=getDevice("OSC")
;  =var osc2=getDevice("OSC:2")
;  =var osc3=getDevice("OSC:3")

#interface setCHCoupling CH(channel):COUPLING (value)
#interface getCHCoupling CH(channel):COUPLING?
:readmath: getMatch(value, "[a-zA-Z]*$")
:string:

#interface setCHScale CH(channel):SCALE (value)
#interface getCHScale CH(channel):SCALE?
:readmath: getMatch(value, "( |^)[-+.0-9].*")

#interface setCHBW CH(channel):BANDWIDTH (value)
#interface getCHBW CH(channel):BANDWIDTH?
:readmath: getMatch(value, "( |^)[-+.0-9].*")

#interface setCHTermination CH(channel):TERMINATION (value)
#interface getCHTermination CH(channel):TERMINATION?
:readmath: getMatch(value, "( |^)[-+.0-9].*")

#interface setCHState SELECT:CH(channel) (value)
#interface getCHState SELECT:CH(channel)?
:readmath: getMatch(value, "( |^)[-+.0-9].*")

;************* Measurement 1-n set up and read
;  Usage is setXXX(<device handle>+":n", <value>)
;           getXXX(<device handle>+":n")
;  where n is the measurement number.  Tyically only 1 through 4 for dual or quad channel scopes.
;  Newer Series 5, Series 6 scopes might have more measurement channels depending.
#interface setMeasSource1 MEASUREMENT:MEAS(channel):SOURCE1 (value)
#interface getMeasSource1 MEASUREMENT:MEAS(channel):SOURCE1?
:readmath: getMatch(value, "[a-zA-Z0-9]*$")
:string:

#interface setMeasSource2 MEASUREMENT:MEAS(channel):SOURCE2 (value)
#interface getMeasSource2 MEASUREMENT:MEAS(channel):SOURCE2?
:readmath: getMatch(value, "[a-zA-Z0-9]*$")
:string:

#interface setMeasType MEASUREMENT:MEAS(channel):TYPE (value)
#interface getMeasType MEASUREMENT:MEAS(channel):TYPE?
:readmath: getMatch(value, "[a-zA-Z]*$")
:string:

#interface setMeasState MEASUREMENT:MEAS(channel):STATE (value)
#interface getMeasState MEASUREMENT:MEAS(channel):STATE?
;:readmath: formatInt(getMatch(value, "( |^)[-+.0-9].*"),1,1)
:readmath: getMatch(value, "( |^)[-+.0-9].*")

#interface getMeasValue MEASUREMENT:MEAS(channel):VALUE?
:readmath: getMatch(value, "( |^)[-+.0-9].*")

#interface getMeasMean MEASUREMENT:MEAS(channel):MEAN?
:readmath: getMatch(value, "( |^)[-+.0-9].*")

#interface getMeasMin MEASUREMENT:MEAS(channel):MINI?
:readmath: getMatch(value, "( |^)[-+.0-9].*")

#interface getMeasMax MEASUREMENT:MEAS(channel):MAXI?
:readmath: getMatch(value, "( |^)[-+.0-9].*")

#interface getMeasStdDev MEASUREMENT:MEAS(channel):STDDEV?
:readmath: getMatch(value, "( |^)[-+.0-9].*")

;************* Measurement I(mmediate) set up and read

#interface setMeasISource1 MEASUREMENT:IMMED:SOURCE1 (value)
#interface getMeasISource1 MEASUREMENT:IMMED:SOURCE1?
:readmath: getMatch(value, "[a-zA-Z0-9]*$")
:string:

#interface setMeasISource2 MEASUREMENT:IMMED:SOURCE2 (value)
#interface getMeasISource2 MEASUREMENT:IMMED:SOURCE2?
:readmath: getMatch(value, "[a-zA-Z0-9]*$")
:string:

#interface setMeasIType MEASUREMENT:IMMED:TYPE (value)
#interface getMeasIType MEASUREMENT:IMMED:TYPE?
:readmath: getMatch(value, "[a-zA-Z]*$")
:string:

#interface getMeasIValue MEASUREMENT:IMMED:VALUE?
:readmath: getMatch(value, "( |^)[-+.0-9].*")


;*********  Horizontal setups
#interface setHorizontalScale HORIZONTAL:SCALE (value)
#interface getHorizontalScale HORIZONTAL:SCALE?
:readmath: getMatch(value, "( |^)[-+.0-9].*")

;*********  Acquire Mode Commands
#interface setAcquireMode ACQUIRE:MODE (value)
#interface getAcquireMode ACQUIRE:MODE?
:readmath: getMatch(value, "[a-zA-Z]*$")
:string:

#interface setRecordLength HORIZONTAL:RECORDLENGTH (value)
#interface getRecordLength HORIZONTAL:RECORDLENGTH?
:readmath: getMatch(value, "[0-9]*$")

;*********  Trigger Commands
#interface setForceTrigger TRIGGER FORCE

#interface setTriggerCoupling TRIGGER:A:EDGE:COUPLING (value)
#interface getTriggerCoupling TRIGGER:A:EDGE:COUPLING?
:readmath: getMatch(value, "[a-zA-Z]*$")
:string:

#interface setTriggerSource TRIGGER:A:EDGE:SOURCE (value)
#interface getTriggerSource TRIGGER:A:EDGE:SOURCE?
:readmath: getMatch(value, "[a-zA-Z0-9]*$")
:string:

#interface setTriggerSlope TRIGGER:A:EDGE:SLOPE (value)
#interface getTriggerSlope TRIGGER:A:EDGE:SLOPE?
:readmath: getMatch(value, "[a-zA-Z]*$")
:string:

#interface setTriggerLevel TRIGGER:A:LEVEL (value)
#interface getTriggerLevel TRIGGER:A:LEVEL?
:readmath: getMatch(value, "( |^)[-+.0-9].*")

#interface setTriggerType TRIGGER:A:TYPE (value)
#interface getTriggerType TRIGGER:A:TYPE?
:readmath: getMatch(value, "[a-zA-Z]*$")
:string:

#interface setTriggerMode TRIGGER:A:MODE (value)
#interface getTriggerMode TRIGGER:A:MODE?
:readmath: getMatch(value, "[a-zA-Z]*$")
:string:


;*********  MATH Channel Commands
#interface setMath1Type MATH1:TYPE (value)
#interface getMath1Type MATH1:TYPE?
:readmath: getMatch(value, "[a-zA-Z]*$")
:string:

#interface setMath1Definition MATH1:DEFINE ("\""+value+"\"")
#interface getMath1Definition MATH1:DEFINE?
;:readmath: getMatch(value, "[a-zA-Z]*$")
:readmath: getMatch(value, "\"(.*)\"")
:string:

#interface setMath1State SELECT:MATH (value)
#interface getMath1State SELECT:MATH?
:readmath: getMatch(value, "( |^)[-+.0-9].*")

#interface setMath1Scale MATH1:VERTICAL:SCALE (value)
#interface getMath1Scale MATH1:VERTICAL:SCALE?
:readmath: getMatch(value, "( |^)[-+.0-9].*")

; Acquisition Channel On/Off Popup.  Note:  Does not remove channels for 2 channel scopes.

#cmdModeLayout 2 5

#cmdMode CH1_On _
SELECT:CH1 1

#cmdMode CH1_Off _
SELECT:CH1 0

#cmdMode CH2_On _
SELECT:CH2 1

#cmdMode CH2_Off _
SELECT:CH2 0

#metaSection QuadMode
;Section for channels 3 and 4 only on quad channel scopes.

#cmdMode CH3_On _
SELECT:CH3 1

#cmdMode CH3_Off _
SELECT:CH3 0

#cmdMode CH4_On _
SELECT:CH4 1

#cmdMode CH4_Off _
SELECT:CH4 0

#metaSection

#cmdMode Math_On _
SELECT:MATH 1

#cmdMode Math_Off _
SELECT:MATH 0


; Main tabbed popup for controlling each channel individually.

; ************  Channel 1 tab   **********************************
#cmdSetup color _ CH_1
(255,255,128)

#cmdSetup buttonsOn CH1_Display CH_1
:read: SELECT:CH1?
:readMath: getMatch(value, "( |^)[-+.0-9].*")
:write: SELECT:CH1
:color: (255,255,128)
:tip: Turns CH1 display on or off
Off 0
On 1

#cmdSetup number Volts/Division CH_1
:read: CH1:SCALE?
:readmath: getMatch(value, "( |^)[-+.0-9].*")
:write: CH1:SCALE
:tip: Volts/Division command sets the vertical sensitivity in Volts/div.
V .0005 10000

#cmdSetup button Zero_Position CH_1
:write: CH1:POSITION 0
:tip: The Zero Position button will put 0 signal mid screen.

#cmdSetup comboboxhot Coupling CH_1
:read: CH1:COUPLING?
:readmath: getMatch(value, "\\b(\\w+)\\s*$")
:write: CH1:COUPLING
:tip: The Coupling command selects the coupling mode of the specified input channel.
DC DC
AC AC
GND GND

#cmdSetup comboboxhot Termination CH_1
:read: CH1:TERMINATION?
:readmath: formatSI(getMatch(value, "( |^)[-+.0-9].*"))
:write: CH1:TERMINATION
:tip: The Termination command selects the input channel load impedance.
1M 1e6
50 50
75 75

#cmdSetup radio Bandwidth_Limit CH_1
:read: CH1:BANDWIDTH?
:readmath: getMatch(value, "( |^)[-+.0-9].*") / 1e6
:write: CH1:BANDWIDTH (value*1e6)
:tip: Sets the bandwidth limit in MHz.
20M 20
250M 250
500M 500
Full 10000

#cmdSetup radio Invert CH_1
:read: CH1:INVERT?
:readmath: getMatch(value, "( |^)[-+.0-9].*")
:write: CH1:INVERT
:tip: Normal or invert/times -1.
Off 0
On 1

; ************  Channel 2 tab   **********************************
#cmdSetup color _ CH_2
(0,255,255)

#cmdSetup buttonsOn CH2_Display CH_2
:read: SELECT:CH2?
:readMath: getMatch(value, "( |^)[-+.0-9].*")
:write: SELECT:CH2
:color: (0,255,255)
:tip: Turns CH2 display on or off
Off 0
On 1

#cmdSetup number Volts/Division CH_2
:read: CH2:SCALE?
:readmath: getMatch(value, "( |^)[-+.0-9].*")
:write: CH2:SCALE
:tip: Volts/Division command sets the vertical sensitivity in Volts/div.
V .0005 10000

#cmdSetup button Zero_Position CH_2
:write: CH2:POSITION 0
:tip: The Zero Position button will put 0 signal mid screen.

#cmdSetup comboboxhot Coupling CH_2
:read: CH2:COUPLING?
:readmath: getMatch(value, "\\b(\\w+)\\s*$")
:write: CH2:COUPLING
:tip: The Coupling command selects the coupling mode of the specified input channel.
DC DC
AC AC
GND GND

#cmdSetup comboboxhot Termination CH_2
:read: CH2:TERMINATION?
:readmath: formatSI(getMatch(value, "( |^)[-+.0-9].*"))
:write: CH2:TERMINATION
:tip: The Termination command selects the input channel load impedance.
1M 1e6
50 50
75 75

#cmdSetup radio Bandwidth_Limit CH_2
:read: CH2:BANDWIDTH?
:readmath: getMatch(value, "( |^)[-+.0-9].*") / 1e6
:write: CH2:BANDWIDTH (value*1e6)
:tip: Sets the bandwidth limit in MHz.
20M 20
250M 250
500M 500
Full 10000

#cmdSetup radio Invert CH_2
:read: CH2:INVERT?
:readmath: getMatch(value, "( |^)[-+.0-9].*")
:write: CH2:INVERT
:tip: Normal or invert/times -1.
Off 0
On 1

#metaSection QuadSetup
;Section for channels 3 and 4 only on quad channel scopes.

; ************  Channel 3 tab   **********************************
#cmdSetup color _ CH_3
(255,0,255)

#cmdSetup buttonsOn CH3_Display CH_3
:read: SELECT:CH3?
:readMath: getMatch(value, "( |^)[-+.0-9].*")
:write: SELECT:CH3
:color: (255,0,255)
:tip: Turns CH3 display on or off
Off 0
On 1

#cmdSetup number Volts/Division CH_3
:read: CH3:SCALE?
:readmath: getMatch(value, "( |^)[-+.0-9].*")
:write: CH3:SCALE
:tip: Volts/Division command sets the vertical sensitivity in Volts/div.
V .0005 10000

#cmdSetup button Zero_Position CH_3
:write: CH3:POSITION 0
:tip: The Zero Position button will put 0 signal mid screen.

#cmdSetup comboboxhot Coupling CH_3
:read: CH3:COUPLING?
:readmath: getMatch(value, "\\b(\\w+)\\s*$")
:write: CH3:COUPLING
:tip: The Coupling command selects the coupling mode of the specified input channel.
DC DC
AC AC
GND GND

#cmdSetup comboboxhot Termination CH_3
:read: CH3:TERMINATION?
:readmath: formatSI(getMatch(value, "( |^)[-+.0-9].*"))
:write: CH3:TERMINATION (value*1.0)
:tip: The Termination command selects the input channel load impedance.
1M 1e6
50 50
75 75

#cmdSetup radio Bandwidth_Limit CH_3
:read: CH3:BANDWIDTH?
:readmath: getMatch(value, "( |^)[-+.0-9].*") / 1e6
:write: CH3:BANDWIDTH (value*1e6)
:tip: Sets the bandwidth limit in MHz.
20M 20
250M 250
500M 500
Full 10000

#cmdSetup radio Invert CH_3
:read: CH3:INVERT?
:readmath: getMatch(value, "( |^)[-+.0-9].*")
:write: CH3:INVERT
:tip: Normal or invert/times -1.
Off 0
On 1

; ************  Channel 4 tab   **********************************
#cmdSetup color _ CH_4
(0,166,0)

#cmdSetup buttonsOn CH4_Display CH_4
:read: SELECT:CH4?
:readMath: getMatch(value, "( |^)[-+.0-9].*")
:write: SELECT:CH4
:color: (0,166,0)
:tip: Turns CH4 display on or off
Off 0
On 1

#cmdSetup number Volts/Division CH_4
:read: CH4:SCALE?
:readmath: getMatch(value, "( |^)[-+.0-9].*")
:write: CH4:SCALE
:tip: Volts/Division command sets the vertical sensitivity in Volts/div.
V .0005 10000

#cmdSetup button Zero_Position CH_4
:write: CH4:POSITION 0
:tip: The Zero Position button will put 0 signal mid screen.

#cmdSetup comboboxhot Coupling CH_4
:read: CH4:COUPLING?
:readmath: getMatch(value, "\\b(\\w+)\\s*$")
:write: CH4:COUPLING
:tip: The Coupling command selects the coupling mode of the specified input channel.
DC DC
AC AC
GND GND

#cmdSetup comboboxhot Termination CH_4
:read: CH4:TERMINATION?
:readmath: formatSI(getMatch(value, "( |^)[-+.0-9].*"))
:write: CH4:TERMINATION
:tip: The Termination command selects the input channel load impedance.
1M 1e6
50 50
75 75

#cmdSetup radio Bandwidth_Limit CH_4
:read: CH4:BANDWIDTH?
:readmath: getMatch(value, "( |^)[-+.0-9].*") / 1e6
:write: CH4:BANDWIDTH (value*1e6)
:tip: Sets the bandwidth limit in MHz.
20M 20
250M 250
500M 500
Full 10000

#cmdSetup radio Invert CH_4
:read: CH4:INVERT?
:readmath: getMatch(value, "( |^)[-+.0-9].*")
:write: CH4:INVERT
:tip: Normal or invert/times -1.
Off 0
On 1

#metaSection

; ************  MATH tab   ***************************************
#cmdSetup color _ MATH
(255,0,0)

#cmdSetup buttonsOn MATH_Display MATH
:read: SELECT:MATH?
:readMath: getMatch(value, "( |^)[-+.0-9].*")
:write: SELECT:MATH 
:color: (255,0,0)
:tip: Turns CH1 display on or off
Off 0
On 1

#cmdSetup number Volts/Division MATH
:read: MATH1:VERTICAL:SCALE?
:readmath: getMatch(value, "( |^)[-+.0-9].*")
:write: MATH1:VERTICAL:SCALE
:tip: Volts/Division command sets the vertical sensitivity in Volts/div.
V .0005 10000

#cmdSetup button Zero_Position MATH
:write: MATH1:VERTICAL:POSITION 0
:tip: The Zero Position button will put 0 signal mid screen.

#cmdSetup comboboxhot Type MATH
:read: MATH:TYPE?
:readmath: getMatch(value, "\\b(\\w+)\\s*$")
:write: MATH:TYPE
:tip: Selects type of Math channel.
Dual DUAL
FFT FFT
ADV ADVANCED

#cmdSetup text Definition MATH
:read: MATH:DEFINE?
:readmath: getMatch(value, "\"(.*)\"")
:update: Type
:write: MATH1:DEFINE ("\""+value+"\"")
:tip: Define math expression like CH1-CH2 or FFT(CH3)

#cmdSetup color _ Horiz-Trig
(220,220,220)

#cmdSetup number Time/Division Horiz-Trig
:read: HORIZONTAL:SCALE?
:readmath: getMatch(value, "( |^)[-+.0-9].*")
:write: HORIZONTAL:SCALE
:tip: Sets the horizontal time per division in sec.
Sec 1e-9 1000

#cmdSetup comboboxhot Aquire_Mode Horiz-Trig
:read: ACQUIRE:MODE?
:readmath: getMatch(value, "[a-zA-Z]*$")
:write: ACQUIRE:MODE
:tip: Sets how points are sampled.
Sample SAMPLE
Peak_Detect PEAKDETECT
Hi_Res HIRES
Envelope ENVELOPE
Average AVERAGE

#cmdSetup number Record_Length Horiz-Trig
:read: HORIZONTAL:RECORDLENGTH?
:readmath: getMatch(value, "[0-9]*$")
:write: HORIZONTAL:RECORDLENGTH
:tip: Sets number of time samples per data record.
Num 500 1e8

#cmdSetup comboboxhot Trigger_Source Horiz-Trig
:read: TRIGGER:A:EDGE:SOURCE?
:readmath: getMatch(value, "[a-zA-Z0-9]*$")
:write: TRIGGER:A:EDGE:SOURCE
:tip: Selects source signal for trigger.
CH1 CH1
CH2 CH2
CH3 CH3
CH4 CH4
LINE LINE
AUX AUX
D0 D0
D1 D1
D2 D2
D3 D
D4 D4

#cmdSetup comboboxhot Trigger_Coupling Horiz-Trig
:read: TRIGGER:A:EDGE:COUPLING?
:readmath: getMatch(value, "[a-zA-Z]*$")
:write: TRIGGER:A:EDGE:COUPLING
:tip: Sets coupling method to trigger circuit.
DC DC
AC AC
HF_Reject HFREJ
LF_Reject LFREJ
Noise_Reject NOISEREJ

#cmdSetup radio Trigger_Slope Horiz-Trig
:read: TRIGGER:A:EDGE:SLOPE?
:readmath: getMatch(value, "[a-zA-Z]*$")
:string:
:write: TRIGGER:A:EDGE:SLOPE
:tip: Normal or invert/times -1.
Rise RISE
Fall FALL
Either EITHER

#cmdSetup number Trigger_Level Horiz-Trig
:read: TRIGGER:A:LEVEL?
:readmath: getMatch(value, "( |^)[-+.0-9].*")
:write: TRIGGER:A:LEVEL
:tip: Sets the level for edge triggering.
V -1e6 1e6

#cmdSetup radio Trigger_Mode Horiz-Trig
:read: TRIGGER:A:MODE?
:readmath: getMatch(value, "[a-zA-Z]*$")
:string:
:write: TRIGGER:A:MODE
:tip: Sets trigger mode; auto retrigger or only on valid trigger.
Auto AUTO
Normal NORMAL

